home *** CD-ROM | disk | FTP | other *** search
/ Clickx 47 / Clickx 47.iso / assets / software / sswitchxp152.exe / source / SpeedswitchXP / SpeedswitchXPDlg.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-07-11  |  5.6 KB  |  195 lines

  1. /*
  2.    SpeedswitchXP V1.5
  3.    - Windows XP CPU Frequency Control for Notebooks -
  4.  
  5.    Copyright(c) 2002-2006 Christian Diefer
  6.  
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License version 2 as 
  9.    published by the Free Software Foundation.
  10.    
  11.    This program is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.    
  16.    You should have received a copy of the GNU General Public License
  17.    along with this program; if not, write to the Free Software
  18.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. #pragma once
  22. #include "afxwin.h"
  23.  
  24. #define WM_ICONNOTIFY (WM_APP+100)
  25.  
  26. // for detecting XP session changes
  27. typedef BOOL (WINAPI *SESSIONREG) ( HWND hWnd, DWORD dwFlags );
  28. typedef BOOL (WINAPI *SESSIONUNREG) ( HWND hWnd );
  29.  
  30. extern TOptions options;
  31.  
  32. // CSpeedswitchXPDlg Dialogfeld
  33. class CSpeedswitchXPDlg : public CDialog
  34. {
  35. // Konstruktion
  36. public:
  37.     CSpeedswitchXPDlg(CWnd* pParent = NULL);    // Standardkonstruktor
  38.   void setCmdLine( TCHAR* cl );
  39.  
  40. // Dialogfelddaten
  41.     enum { IDD = IDD_SPEEDSWITCHXP_DIALOG };
  42.  
  43.     protected:
  44.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV-Unterstⁿtzung
  45.     virtual void PostNcDestroy();
  46.  
  47.  
  48. // Implementierung
  49. protected:
  50.     HICON m_hIcon;
  51.   HICON iBattOpt;
  52.   HICON iMaxPerf;
  53.   HICON iMaxBatt;
  54.   HICON iDynamic;
  55.   HICON curIcon;
  56.   HICON iTrayBattery;
  57.   HICON iBattCharge;
  58.   HICON modBatteryIcon;
  59.   HICON cpuDataIcon;
  60.  
  61.     // Generierte Funktionen fⁿr die Meldungstabellen
  62.     virtual BOOL OnInitDialog();
  63.     afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  64.     afx_msg void OnPaint();
  65.     afx_msg HCURSOR OnQueryDragIcon();
  66.   afx_msg void OnBnClickedClose();
  67.     afx_msg void OnClose();
  68.     afx_msg void OnAbout();
  69.   LRESULT OnIconNotify( WPARAM wp, LPARAM lp );
  70.   LRESULT OnWtsSessionChange( WPARAM wp, LPARAM lp );
  71.   LRESULT OnPowerBroadCast( WPARAM wp, LPARAM lp );
  72.   LRESULT OnTaskBarCreated( WPARAM wp, LPARAM lp );
  73.   afx_msg void OnMaxPerfMenu( void );
  74.   afx_msg void OnBattOptMenu( void );
  75.   afx_msg void OnMaxBattMenu( void );
  76.   afx_msg void OnDynamicMenu( void );
  77.   afx_msg void OnShowMainMenu( void );
  78.   afx_msg void OnSelectShutdown( void );
  79.     afx_msg void OnTimer( UINT nIDEvent );
  80.   afx_msg void OnCbnSelchangeCombo1();
  81.   afx_msg void OnCbnSelchangeCombo2();
  82.   afx_msg void OnBnClickedOptbutton();
  83.   afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  84.   afx_msg void OnBnClickedButton2();
  85.   afx_msg void OnCbnSelchangeDisplayAC();
  86.   afx_msg void OnCbnSelchangeDisplayDC();
  87.   afx_msg void OnCbnSelchangeDiskAC();
  88.   afx_msg void OnCbnSelchangeDiskDC();
  89.   afx_msg void OnCbnSelchangeStandbyAC();
  90.   afx_msg void OnCbnSelchangeStandbyDC();
  91.   afx_msg void OnCbnSelchangeHibAC();
  92.   afx_msg void OnCbnSelchangeHibDC();
  93.   afx_msg void OnBnClickedCPUData();
  94.   afx_msg void OnBnClickedButton4();
  95.     DECLARE_MESSAGE_MAP()
  96.  
  97. private:
  98.   void getRegKeys();
  99.   void setRegKeys();
  100.   void setAutoStartRegistry();
  101.   void deleteAutoStartRegistry();
  102.   void minimizeToTray();
  103.   void displayTrayIcon( DWORD msg );
  104.   bool closeQuery();
  105.   void setCPUIcon( int policy );
  106.   void MenuSpeedHandler( int throttle );
  107.   void readCPUSpeed();
  108.   void readCPULoad();
  109.   void drawDiagram();
  110.   TCHAR* getWinErr( DWORD errcode );
  111.   void batteryDisplay( SYSTEM_POWER_STATUS* sps );
  112.   void removeBatteryIcon();
  113.   void displayCPUDataIcon( int msg );
  114.   void removeCPUDataIcon();
  115.   void showBatteryIcon( int msg, HICON icon, SYSTEM_POWER_STATUS* sps );
  116.   int findDefaultIndex( int val );
  117.   int findDiskIndex( int val );
  118.   int fillHibernationTimes( CComboBox* box, int* hibernation, int idx, int what );
  119.   void fillPolicyStrings( CComboBox* box );
  120.   int findHibernationIndex( int* hibernation, int val, int maxIndex );
  121.   void initPowerBoxes();
  122.   BOOL initPowerValues();
  123.   void initStrings();
  124.  
  125.   CRect cpuFrame;
  126.   CRect legendFrame;
  127.   CString m_szCPULoad;
  128.   CString m_szCPUSpeed;
  129.   BOOL trayIcon;
  130.   SYSTEM_POWER_STATUS pwrStatus;
  131.   int m_iACState;
  132.   int m_iDCState;
  133.   BYTE speedArr[1204];
  134.   BYTE loadArr[1204];
  135.   int diagramOffset;
  136.   int loadIndex;
  137.   int speedIndex;
  138.   int ybaseoffset;
  139.   int xbaseoffset;
  140.   int tickCounterCPU;
  141.   int tickCounterCheck;
  142.   CWnd* frameStart;
  143.   CWnd* frameEnd;
  144.   int legendLine;
  145.   BOOL activeTimer;
  146.   CString m_szMaxCPUSpeed;
  147.   UCHAR bitmap[128];
  148.   BOOL batteryIconActive;
  149.   BOOL batteryIconCharge;
  150.   int batteryValue;
  151.   BOOL cpuDataIconActive;
  152.   int cpuIconVal1;
  153.   int cpuIconVal2;
  154.   CComboBox m_cStandbyAC;
  155.   CComboBox m_cStandbyDC;
  156.   CComboBox m_cHibernationAC;
  157.   CComboBox m_cHibernationDC;
  158.   CComboBox m_cDisplayAC;
  159.   CComboBox m_cDisplayDC;
  160.   CComboBox m_cDiskAC;
  161.   CComboBox m_cDiskDC;
  162.   int defaultTimes[18];
  163.   int diskTimes[18];
  164.   int hibernationTimesAC[18];
  165.   int hibernationTimesDC[18];
  166.   int maxHibIndexAC;
  167.   int maxHibIndexDC;
  168.   int curSpeed;   // for the CPU data tray icon
  169.   int curLoad;    // for the CPU data tray icon
  170.   bool forceShutdown;
  171.   CString legend1;
  172.   CString legend2;
  173.   CString err;
  174. };
  175.  
  176. typedef struct _NOTIFYICONDATA_CD { 
  177.     DWORD cbSize; 
  178.     HWND hWnd; 
  179.     UINT uID; 
  180.     UINT uFlags; 
  181.     UINT uCallbackMessage; 
  182.     HICON hIcon; 
  183.     TCHAR szTip[128];
  184.     DWORD dwState; 
  185.     DWORD dwStateMask; 
  186.     TCHAR szInfo[256]; 
  187.     union {
  188.       UINT  uTimeout; 
  189.       UINT  uVersion; 
  190.     } DUMMYUNIONNAME;
  191.     TCHAR szInfoTitle[64]; 
  192.     DWORD dwInfoFlags; 
  193. } NOTIFYICONDATA_CD, *PNOTIFYICONDATA_CD; 
  194.  
  195.